<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>宇视手机移动平台-管理系统</title>
<script type="text/javascript">
	var basePath = '${basePath}';
</script>
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="${basePath}/static/adminLTE/css/font-awesome.min.css">
<link rel="stylesheet" href="${basePath}/static/adminLTE/css/login/animate.css">
<link rel="stylesheet" href="${basePath}/static/adminLTE/css/login/style.css">
</head>
<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">宇视科技</h1>

            </div>
            <h3>欢迎使用 UNIVIEW</h3>

            <form id="loginForm" class="m-t" style="margin:0 250px;" role="form" action="${basePath}/doLogin">
                <div class="form-group">
                    <input type="text" name="userName" class="form-control" placeholder="用户名" required="">
                </div>
                <div class="form-group">
                    <input type="password" name="password" class="form-control" placeholder="密码" required="">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
            </form>
            <div class="msg"></div>
        </div>
    </div>

</body>
<!-- jQuery 2.2.3 -->
<script src="${basePath}/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="${basePath}/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript">
	jQuery("#loginForm").submit(function () {
		var $this = jQuery(this);
		var action = $this.attr("action");
		jQuery.ajax({
			url:action,
			dataType:"json",
			data: $this.serialize(),
			type: "post",
			success: function (json) {
				if (json.success) {
					// 跳转到首页
					window.location.href = basePath + "/home/index";
				} else {
					// 提示错误信息
					jQuery(".msg").html(json.message);
				}
			},
			error : function() {
				jQuery(".msg").html("登录失败，请确认网络连接正常！");
			},
		});
		
		return false;
	});
</script>
</html>